body {
    font-family: sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align items to the top */
    min-height: 100vh;
    background-color: #f0f0f0;
    margin: 20px 0; /* Add some margin */
    padding: 0;
    box-sizing: border-box;
}

.container {
    text-align: center;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1, h2 {
    color: #333;
}

.game-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align canvas and side panel at the top */
    gap: 20px; /* Space between canvas and side panel */
    margin-top: 20px;
}

#gameCanvas {
    border: 3px solid #333;
    background-color: #e0e0e0; /* Light gray background for the game area */
}

#nextPieceCanvas {
    border: 1px solid #ccc;
    background-color: #e9e9e9;
}

.side-panel {
    width: 150px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 15px; /* Space between elements in side panel */
}

.side-panel div {
    background-color: #f8f8f8;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.side-panel h2 {
    margin: 0 0 5px 0;
    font-size: 1em;
    color: #555;
}

.side-panel p {
    margin: 0;
    font-size: 1.2em;
    font-weight: bold;
    color: #007bff;
}

button {
    padding: 10px 15px;
    font-size: 1em;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    margin-top: 5px; /* Add some space between buttons */
}

button:hover {
    background-color: #0056b3;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.5); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

.modal.visible {
    display: flex; /* Show when visible class is added */
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px; /* Max width */
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.modal-content h2 {
    margin-top: 0;
}

.modal-content input[type="text"] {
    width: calc(100% - 22px); /* Full width minus padding/border */
    padding: 10px;
    margin: 15px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.modal-buttons {
    margin-top: 15px;
    display: flex;
    justify-content: space-around; /* Space out buttons */
    gap: 10px;
}

#leaderboardContent {
    margin-top: 15px;
    text-align: left;
    max-height: 300px; /* Limit height and allow scroll */
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 10px;
    background-color: #f9f9f9;
}

#leaderboardContent ol {
    padding-left: 20px;
}
#leaderboardContent li {
    margin-bottom: 8px;
    padding: 5px;
    border-bottom: 1px dashed #eee;
}
#leaderboardContent li:last-child {
    border-bottom: none;
}
#leaderboardContent .player-name {
    font-weight: bold;
    color: #333;
    display: inline-block;
    min-width: 150px; /* Adjust as needed */
}
#leaderboardContent .player-score {
    color: #007bff;
    float: right; /* Align score to the right */
}

.status-message {
    margin-top: 10px;
    font-size: 0.9em;
    min-height: 1.2em; /* Reserve space */
}
.status-message.error {
    color: red;
    font-weight: bold;
}
.status-message.success {
    color: green;
    font-weight: bold;
}